//
//  QDApplyController.m
//  QuickDoctor
//
//  Created by ycw on 2016/12/21.
//  Copyright © 2016年 Eric. All rights reserved.
//

#import "QDApplyController.h"
#import "QDApplyCell.h"
#import "QDOrderController.h"

static NSString *cellID = @"cell";

@interface QDApplyController ()<UITableViewDelegate,UITableViewDataSource>

@property(strong,nonatomic) NSArray<NSString *> *array;

@end

@implementation QDApplyController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.title = @"申请名医通";
    
    [self setUpUI];
}

#pragma mark
#pragma mark - 搭建界面
- (void) setUpUI
{
    
    UITableView *tableView = [[UITableView alloc] init];
    
    [self.view addSubview:tableView];
    
    [tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.edges.equalTo(self.view);
    }];
    
    tableView.delegate = self;
    
    tableView.dataSource = self;
    
    tableView.estimatedRowHeight = 80;
    
    tableView.rowHeight = UITableViewAutomaticDimension;
    
    self.array = @[@"张先生 高血压",@"李先生 心血管",@"王先生 骨科病",@"赵先生 心肌梗塞",@"马先生 关节炎",@"过先生 腰肌劳损"];
    
    [tableView registerClass:[QDApplyCell class] forCellReuseIdentifier:cellID];
    
    
    
}

#pragma mark
#pragma mark - 实现代理方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    
    return 1;
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    
    
    return self.array.count;
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    QDApplyCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath];
    
    cell.lblPatient.text = self.array[indexPath.row];
    
    return cell;
    
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    QDOrderController *orderC = [[QDOrderController alloc] init];
    
    [self.navigationController pushViewController:orderC animated:YES];
    
}



@end
